<?

global $_APP_OBJECT_MENU;

$_APP_OBJECT_MENU = array (
	array (label=>"Access Administrator",link=>"accounts/",
		style=>"css_menu_option_a",
		options=>array (
			array (
				label=>"Account Manager",
				link=>"users/",
				style=>"css_menu_option_b"
			),
			array (
				label=>"Modules",
				link=>"modules/",
				style=>"css_menu_option_b"
			),
			array (
				label=>"Roles",
				link=>"roles/",
				style=>"css_menu_option_b"
			),
			array (
				label=>"Workgroups",
				link=>"workgroups/",
				style=>"css_menu_option_b"
			),
			array(
				label=>"Objects",
				link=>"objects/",
				style=>"css_menu_option_b"
			)
		),
	),
	array (label=>"Projects Aministrator",link=>"projects/",
		style=>"css_menu_option_a",
		options=>array (
			array (
				label=>"Project Manager",
				link=>"projects/",
				style=>"css_menu_option_b",
				/* options=>array (
					array (
						label=>"Categories",
						link=>"categories/",
						style=>"css_menu_option_c"
					),
				), */
			),
			/* array (
				label=>"Project Tasks",
				link=>"tasks/",
				style=>"css_menu_option_b",
			), */
			array(
				label=>"Phases",
				link=>"phases/",
				style=>"css_menu_option_b",
				options=>array (
					array (
						label=>"Categories",
						link=>"categories/",
						style=>"css_menu_option_c"
					),
				),
			)
		),
	),
	array (label=>"User Options",link=>"users/",
		style=>"css_menu_option_a",
		options=>array (
			array (
				label=>"My Tasks",
				link=>"tasks/",
				style=>"css_menu_option_b",
			),
			array (
				label=>"Messages",
				link=>"messages/",
				style=>"css_menu_option_b",
			),
			array (
				label=>"Calendar",
				link=>"calendar/",
				style=>"css_menu_option_b",
			),
			array (
				label=>"Timesheet",
				link=>"timesheet/",
				style=>"css_menu_option_b",
			),
			array (
				label=>"Notes",
				link=>"notes/",
				style=>"css_menu_option_b",
			),
		),
	)
);

function _app_iface_navigation_begin ($container) {

	print <<<HTML
	<td class="css_iface_navigation">

HTML;
}

function _app_iface_navigation_end ($container) {

	print <<<HTML
	</td>

HTML;
}

function _app_iface_display_begin ($container) {

	print <<<HTML
	<td class="css_iface_display">


HTML;
}

function _app_iface_display_end ($container) {

	print <<<HTML
	</td>

HTML;
}

function _app_iface_navigation () {

	global $_APP_OBJECT_MENU;

	$_APP_MENU = new Container ();
	$_APP_MENU->set_callback_begin ("_app_iface_menu_begin");
	$_APP_MENU->set_callback_end ("_app_iface_menu_end");

	_app_create_menu ($_APP_MENU, $_APP_OBJECT_MENU);

	return $_APP_MENU;
}

function _app_create_menu ($container, $options) {

	foreach ($options as $option) {

		$_APP_MENU_OPTION = new Container ();
		$_APP_MENU_OPTION->set_callback_begin
				("_app_iface_menu_option");
		$_APP_MENU_OPTION->set_option
				("callback_end", false);
		$_APP_MENU_OPTION->set_variable ("label", $option["label"]);
		$_APP_MENU_OPTION->set_variable ("link",
				$container->get_variable ("link") .
				$option["link"]);
		$_APP_MENU_OPTION->set_variable ("class", $option["style"]);

		if ($option["options"]) _app_create_menu
				($_APP_MENU_OPTION, $option["options"]);

		$container->insert_container ($_APP_MENU_OPTION);
	}
}

function _app_iface_menu_begin ($container) {

	print <<<HTML
<table cellpadding="0" cellspacing="0" class="css_main_navigation">

HTML;
}

function _app_iface_menu_end ($container) {

	print <<<HTML
</table>


HTML;
}

function _app_iface_menu_option ($container) {

	print <<<HTML
<tr><td class="{$container->get_variable ("class")}"><a href="/admin/{$container->get_variable ("link")}" class="{$container->get_variable ("class")}">::&nbsp;{$container->get_variable ("label")}</a></td></tr>

HTML;
}

function _app_tab ($container) {

	$primary_key = $container->get_variable ("primary_key");
	$primary_value = $container->get_variable ("primary_value");
	$label = $container->get_variable ("label");

	$label = ($wrapper = $container->get_variable ("wrapper")) ?
			<<<HTML
<div class="{$wrapper}">{$label}</div>
HTML
			: $label;

	print <<<HTML
	<td class="{$container->get_variable ("class")}" onmouseover="javascript: this.className='css_tabbing_c';" onmouseout="javascript: this.className='{$container->get_variable ("class")}';"><a class="css_tabbing" href="?{$container->get_variable ("fs_tab_id")}={$container->get_variable ("fs_tab")}&{$primary_key}={$primary_value}&{$container->get_variable ("options")}">{$label}</a></td>

HTML;
}

function _app_tab_row_split ($container) {

	print <<<HTML
</tr>
</table>

	</td>
</tr>
<tr>
	<td>

<table class="css_tabbing" border="0" cellpadding="0" cellspacing="0">
<tr>

HTML;
}

function _app_tabbing_begin ($container) {

	print <<<HTML
<table border="0" cellpadding="0" cellspacing="0" width="100%" height="1">
<tr>
	<td>


<table class="css_tabbing" border="0" cellpadding="0" cellspacing="0">
<tr>

HTML;
}

function _app_tabbing_end ($container) {

	print <<<HTML
</tr>
</table>

	</td>
</tr>
</table>
<br>

HTML;
}

function _app_tabbing_container_begin ($container) {

	print <<<HTML
<div class="css_tabbing_container">

HTML;
}

function _app_tabbing_container_end ($container) {

	print <<<HTML
</div>

HTML;
}

function _app_tabbing_tabs_begin ($container) {

	print <<<HTML
<div class="css_tabbing_tabs">

HTML;
}

function _app_tabbing_tabs_end ($container) {

	print <<<HTML
</div>

HTML;
}

function _app_tabbing_panel_begin ($container) {

	print <<<HTML
<div class="css_tabbing_panel">

HTML;
}

function _app_tabbing_panel_end ($container) {

	print <<<HTML
</div>

HTML;
}

?>
